<?php
namespace app\datamanage\model;
use think\Model;

/**
 *
 */
class Zhenpin extends Model
{

    function showZhenpin($condition='')
    {
    	if(!$condition){
    		$res = db('zhenpin')->field('id, name, teacase_id, teaarea_id, bangdan_id, detailintro, score, click')->order('score desc')->select();
        	return $res;
    	}
        $res = db('zhenpin')->field('id, name, teacase_id, teaarea_id, bangdan_id, detailintro, score, click')->where($condition)->order('score desc')->select();
        return $res;
    }

    function updateNew($id, $data)
    {
        db('zhenpin')->where('id', $id)->update($data);
    }

    //返回某茶类对应的产地
    function reTeaArea($teacase_id)
    {
       $res = db("case_area")->field("teaarea_id")->where("teacase_id",$teacase_id)->select();
       return $res;
    }

}












?>
